package com.example.order.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

@Configuration
//饿汉模式这个注解是eureka包中的
//@LoadBalancerClient
public class RestConfig {
    @Bean
    @LoadBalanced//use serviceName to rpc
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }

/*    @Bean
    //@ExcludeFromComponentScan
    public IRule ribbonRule() {
        // 负载均衡规则，改为随机
        return new RandomRule();
    }*/

}
